package per.zqx.rabbit.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * DeadRabbitConfig,
 *
 * @author Sa, Zhang 2021-06-06 21:52
 */
@Configuration
public class DeadRabbitConfig {
    // 死信交换机
    @Bean
    public FanoutExchange deadExchange() {
        return new FanoutExchange("dead-fanout-exchange");
    }
    // 死信队列
    @Bean
    public Queue deadQueue() {
        return new Queue("dead.fanout.queue");
    }
    // 绑定
    @Bean
    public Binding deadBind() {
        return BindingBuilder.bind(deadQueue()).to(deadExchange());
    }
}
